﻿using System.Web;

namespace cms.libs.Utility
{
    public class SessionUtility
    {

        #region --- Khai báo tên các session ---

        //Dùng để lưu AccountID|AccountName|AccountTypeID|SessionKey|PasswordKey    //SessionKey|PasswordKey dùng để kiểm xoát đăng nhập 1 lần
        public const string SessionAccount = "Account";
        public const string SesionCurrentGameId = "CurrentGameSessionId";
        public const string SesionGameRoomID = "GameRoomId";
        public const string SessionFacebookID = "FacebookIDConfig";
        public const string SESSION_EMail = "Email";
        public const string SESSION_Books = "Books";
        public const string SESSION_Accesstoken = "Accesstoken";
        #endregion




        /// <summary>
        /// lấy ra giá trị session
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public object GetValue(string name)
        {
            return HttpContext.Current.Session[name];
        }




        /// <summary>
        /// hủy một session
        /// </summary>
        /// <param name="name"></param>
        public void Remove(string name)
        {
            HttpContext.Current.Session.Remove(name);

        }




        /// <summary>
        /// Nạp giá trị cho session
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        public void SetValue(string name, object value)
        {
            HttpContext.Current.Session[name] = value;
        }

    }
}
